import React from 'react';
import {Router} from "react-router-dom"
import './App.css';
class Heads extends React.Component{
  constructor(props){
    super(props)
    this.state={
      hello:"1807你们好"
    }
    this.fn=this.fn.bind(this)
  }
  render(){
    return(
      <div>
        <h3 onClick={this.fn}>头部</h3>
        <p>{this.props.na}</p>
      </div>
    )
  }
  fn(){
    // console.log(111)
    var hello = this.state.hello
    this.props.onlick(hello)
  }
}
class App extends React.Component{
  static defaultPrpps={
    name:"哈哈"
  }
  constructor(props){
    super(props)
    this.state={
      txt:"hello world",
      a:""
    }
    this.fn=this.fn.bind(this)
    this.ff=this.ff.bind(this)
  }
  render(){
    console.log(this)
    return(
      <div>
        <Heads na={this.state.txt} onlick={this.ff} />
        <h3 onClick={this.fn}>1807
          <span>{this.state.a}</span>
        </h3>
      </div>
    )
  }
  ff(v){
    // console.log(v)
    this.setState({
      a:v
    })
  }
  fn(ev){
    console.log(ev.target)
  }
}

export default App;
